#include "DirectLOL/graphicElement/graphicElement.h"
#include <stdlib.h>
#include <stdio.h>

/**********************************************************/
/*                  Constructeurs                         */
/**********************************************************/

Vectorf GraphicElement::colorPicking= Vectorf(1,1,1);

GraphicElement::GraphicElement(int aType)
{
    InitBooleans();

    type=aType;

    translation= new Vectorf();
    translationT1= new Vectorf();
    rotation = new Vectorf();

    pickingColor= colorPicking;
    IncrementColorPicking();
}

void GraphicElement::DefineColorPicking()
{

}

void GraphicElement::IncrementColorPicking()
{
    if(colorPicking.x()<254)
    {
        colorPicking.x(colorPicking.x()+1);
    }
    else
    {
        colorPicking.x(1);
        colorPicking.y(colorPicking.y()+1);
    }
}

GraphicElement::GraphicElement(int aType, Vectorf aTranslation)
{
    pickingColor= colorPicking;
    IncrementColorPicking();
    InitBooleans();

    type=aType;

    translation= new Vectorf(aTranslation);
    translationT1= new Vectorf();
    rotation= new Vectorf(0,0,0);
}


GraphicElement::GraphicElement(int aType, Vectorf aTranslation, Vectorf aRotation)
{

    pickingColor= colorPicking;
    IncrementColorPicking();
    InitBooleans();

    type=aType;

    translation= new Vectorf(aTranslation);
    translationT1= new Vectorf();
    rotation = new Vectorf(aRotation);
}

void GraphicElement::InitBooleans()
{
    scaling= new Vectorf(1.0, 1.0, 1.0);
    picking=0;
    kill=0;
    state=1;
    physicOn=0;
}

GraphicElement::~GraphicElement()
{

}

void GraphicElement::AddAcceleration(Vectorf *aAcceleration)
{
    physic->AddAcceleration(aAcceleration);
}

void GraphicElement::ResolvePhysic()
{
    physic->Do();
}

void GraphicElement::SetLight()
{
    lightOn=1;
    material=new Material();
}

void GraphicElement::SetPhysic()
{
    physicOn=1;
    physic= new Physic(translationT1);
}


